<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c_rt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt"  prefix="fmt_rt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page language="java" 
	import="java.util.*" 
	import="com.jp.fm.data.*"
	import="com.jp.fm.*"
	pageEncoding="ISO-8859-1"%>

<script type="text/javascript">
  		
  		$(function() {
  		$(document.body).on("click", ".click-link", function(){		
			var url = $(this).attr('url');
			
			if(url.indexOf('?') == -1) {
				url = url + '?';
			}
			
			<c:forEach var="acctTypeEntry" items="${accountsByType}">		
				elem = $("#<c:out value='${acctTypeEntry.key.id}'/>Account");	
				if (elem.hasClass ("ui-accordion-header-active")) {
   					url = url + '&o=<c:out value='${acctTypeEntry.key.id}'/>';
				}				
			</c:forEach>
			
			location.href = url;
		})
		});
  		
</script> 


<div id="header" class="pageheader">
	<h2>Home Financial Manager</h2>
	<span class="menu"><a class="click-link" url="/fm/secured/ShowAccountSummary">Home</a> | 
		<a class="click-link" url="/fm/secured/ShowTransactions">Transaction Search</a> |
		<a class="click-link" url="/fm/secured/ShowTrends">Trends</a> | 
		<a class="click-link" url="/fm/secured/Cache.jsp">Cache</a> | 
		<a class="click-link" url="/fm/Logout">Logout</a></span> 
</div>